<?php

use think\migration\Migrator;

class AlterDmjConfigUrl extends Migrator
{
    public function up()
    {
        //呆萌价
        if (isProd()){
            $url = 'http://www.shop.dmjvip.com';
        }else{
            $url = 'http://wx.mi.dmjvip.com';
        }

        \app\model\Config::findOrCreate([
            'type' => 'profit_share',
            'name' => '呆萌价域名',
            'field' => 'profit_share_request_url',
            'value' => $url,
        ]);
    }

    public function down()
    {
        \app\model\Config::where('type','profit_share')->where('field', 'profit_share_request_url')->delete();
    }
}
